This sample demonstrates how to work with Portable Document Format (PDF) files programmatically.
Specifically, this sample shows how to:
- Scroll through various pages in a PDF file.
- Use semantic zoom to switch between viewing single and multiple pages in a PDF file.
- Share a PDF file in an email message.
For detailed info about how this sample works, see the companion PDF viewer end-to-end sample documentation.
To obtain an evaluation copy of Windows 8.1, go to Windows 8.1.
To obtain an evaluation copy of Microsoft Visual Studio 2013, go to Visual Studio 2013.
Note For Windows 8 app samples, download the Windows 8 app samples pack. The samples in the Windows 8 app samples pack will build and run only on Microsoft Visual Studio 2012.
Related topics
Operating system requirements
| Client | |
|---|---|
| Server |
Build the sample
- Start Visual Studio 2013 and select File > Open > Project/Solution.
- Go to the directory in which you unzipped the sample. Go to the directory named for the sample, and double-click the Visual Studio 2013 Solution (.sln) file.
- Press F7 or use Build > Build Solution to build the sample.
Run the sample
To debug the app and then run it, press F5 or use Debug > Start Debugging. To run the app without debugging, press Ctrl+F5 or use Debug > Start Without Debugging.
To test semantic zoom with the keyboard, press CTRL+PLUS SIGN or CTRL+MINUS SIGN. If your testing machine doesn't have touch enabled or does not support touch, run the app in Simulator mode in Microsoft Visual Studio. After the app starts in the simulator, click the Pinch/zoom touch mode icon on the simulator's edge, and then use the mouse to simulate pinch and zoom touch gestures. To perform these gestures, press and hold the left mouse button while rotating the mouse wheel backward or forward. To turn off pinch/zoom touch mode, click either the Mouse mode or Basic touch icon on the simulator's edge.
To test device rotation, if you have a desktop PC or your testing machine doesn't have rotation enabled, run the app in Simulator mode in Visual Studio. After the app starts in the simulator, click the Rotate clockwise (90 degrees) or Rotate counterclockwise (90 degrees) icon on the simulator's edge to simulate device rotation.
After the app starts, you can load a different PDF file. To do this, display the app bar: swipe from the top or bottom edge; or right-click the mouse; or with Basic touch mode enabled in the simulator, with the mouse pointer anywhere on the top or bottom device frame, press and hold the left mouse button while dragging onto the app's surface. Click the open button on the app bar, and browse to and select the desired PDF file.
In the JavaScript sample: to share the loaded PDF file in an email message, display the charms bar: swipe from the right edge; or move the mouse pointer to the upper-right or lower-right corner; or with Basic touch mode enabled in the simulator, with the mouse pointer anywhere on the right device frame, press and hold the left mouse button while dragging onto the app's surface. Click the Share charm, and follow the on-screen instructions.